package com.actions;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;

import com.bean.ExtraCraftPartStandard;
import com.opensymphony.xwork2.ActionSupport;
import com.serviceImpl.CraftPartStandardServiceImpl;

public class CraftPartStandardAction extends ActionSupport {

	private CraftPartStandardServiceImpl craftPartStandardBiz;	//工艺部件实现类
	private List<ExtraCraftPartStandard> ecpStandardList;		//工艺部件标准详情集合
	
	private JSONArray cpStandardJsons;
	private Map<String, String> qoptions;
	
	private String qcraftStdCode;
	private String qcraftStdName;
	

	/**
	 * 无参构造函数
	 */
	public CraftPartStandardAction() {
		ecpStandardList = new ArrayList<ExtraCraftPartStandard>();
		cpStandardJsons = new JSONArray();
		qoptions = new HashMap<String, String>();
	}

	public CraftPartStandardServiceImpl getCraftPartStandardBiz() {
		return craftPartStandardBiz;
	}

	public void setCraftPartStandardBiz(
			CraftPartStandardServiceImpl craftPartStandardBiz) {
		this.craftPartStandardBiz = craftPartStandardBiz;
	}
	
	public List<ExtraCraftPartStandard> getEcpStandardList() {
		return ecpStandardList;
	}

	public void setEcpStandardList(List<ExtraCraftPartStandard> ecpStandardList) {
		this.ecpStandardList = ecpStandardList;
	}

	public JSONArray getCpStandardJsons() {
		return cpStandardJsons;
	}

	public void setCpStandardJsons(JSONArray cpStandardJsons) {
		this.cpStandardJsons = cpStandardJsons;
	}

	public String getQcraftStdCode() {
		return qcraftStdCode;
	}

	public void setQcraftStdCode(String qcraftStdCode) {
		this.qcraftStdCode = qcraftStdCode;
	}

	public String getQcraftStdName() {
		return qcraftStdName;
	}

	public void setQcraftStdName(String qcraftStdName) {
		this.qcraftStdName = qcraftStdName;
	}

	public Map<String, String> getQoptions() {
		return qoptions;
	}

	public void setQoptions(Map<String, String> qoptions) {
		this.qoptions = qoptions;
	}

	/**
	 * 获取所有工艺部件标准详情
	 * @return
	 */
	public String getAllStandards(){
		ecpStandardList.clear();
		qoptions.clear();
		ecpStandardList = craftPartStandardBiz.getAllStandards(qoptions);
		cpStandardJsons = JSONArray.fromObject(ecpStandardList); 
		return "allStandards";
	}
}
